(function(angular) {
	'use strict';
	angular.module("fs.waf").factory("amendmentService", amendmentService);
	amendmentService.$inject = [ '$q', 'loggerFactory' ];
	function amendmentService($q, loggerFactory) {
		var log = loggerFactory.getLogger("amendmentService");
		return {
			initDataOptions : initDataOptions,
			updatpDataOptions : updatpDataOptions
		};
		
		function initDataOptions($scope, ctrl) {
			ctrl.generalFlagOptions = getIsDefaultsOptions();
			ctrl.generalFlagOptions.callback = {"changed" : "vm.initTabs"};
			ctrl.obligorFlagOptions = getIsDefaultsOptions();
			ctrl.obligorFlagOptions.callback = {"changed" : "vm.initTabs"};
			ctrl.interestFlagOptions = getIsDefaultsOptions();
			ctrl.interestFlagOptions.callback = {"changed" : "vm.initTabs"};
			ctrl.pastdueFlagOptions = getIsDefaultsOptions();
			ctrl.pastdueFlagOptions.callback = {"changed" : "vm.initTabs"};
			ctrl.billingScheduleFlagOptions = getIsDefaultsOptions();
			ctrl.billingScheduleFlagOptions.callback = {"changed" : "vm.initTabs"};
			
			ctrl.generalPerformOptions = getIsDefaultsOptions();
			ctrl.generalRepeatExtendFlagOptions = getIsDefaultsOptions();
			ctrl.billOnEomOptions = getIsDefaultsOptions();
		}
		
		function updatpDataOptions($scope, ctrl) {
			initDataOptions($scope, ctrl);
		}
		
		function getIsDefaultsOptions() {
			var option = {
					"data" : [{
						"value" : "Y",
						"label" : "label.global.yes"
					}, {
						"value" : "N",
						"label" : "label.global.no"
					} ]
			};
			return option;
		}
	}
})(angular);